package org.com.behavioralPattern.mementoPattern;

/**
 * @author Jonny
 * @version 1.0
 * @Description:
 * @date 2021/4/27 17:14
 */
public class Document {
    String content;//需要备份的状态
    String otherContent; //不需要备份的状态

    public Backup save() {
        System.out.println("保存备份");
        return new Backup(content);
    }

    public void resume(Backup backup) {
        System.out.println("恢复备份");
        content = backup.content;
    }

    @Override
    public String toString() {
        return "content:" + content + ",otherContent:" + otherContent;
    }
}
